package com.safewind.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.safewind.dao.ValueDao;
import com.safewind.model.*;
import com.safewind.service.IValueService;
import com.safewind.util.PropertiesUtil;
import com.safewind.util.StringUtil;

@Service("valueService")
public class ValueServiceImpl implements IValueService {
	@Resource
	private ValueDao valueDao;

	@Override
	public void insertValue(String userId, int cost, String content) {
		Value value = new Value();
		value.setCost(cost);
		value.setUserId(userId);
		value.setOperate(content);
		value.setPkId(StringUtil.getUUID());
		value.setAddTime(new Date());
		value.setAgency(PropertiesUtil.getValue("sign"));
		valueDao.insertSelective(value);
	}

	@Override
	public List<Value> getAll(String userId) {
		return valueDao.getAll(userId);
	}

}
